FROM golang:alpine AS builder
RUN mkdir /app
# 设置工作目录

WORKDIR /app
#ADD go.mod .
#ADD go.sum .

ADD . .
ENV GOPROXY=https://goproxy.cn,direct \
    GOOS=linux \
    GOARCH=amd64

RUN go mod download
#RUN go get github.com/githubnemo/CompileDaemon

EXPOSE 8088
RUN go build -o main main.go
#ENTRYPOINT CompileDaemon --build="go build main.go" --command=./main
FROM builder
COPY --from=builder /app/main /app/main
ENTRYPOINT  sleep 5 && ./main
#CMD ["tail", "-f", "/dev/null"]